js fileinput get content

143

js fileinput get content -

//get file object
var file = document.getElementById('myFile').files[0];
if (file) {
  // create reader
  var reader = new FileReader();
  reader.readAsText(file);
  reader.onload = function(e) {
    // browser completed reading file - display it
    alert(e.target.result);                     
  };
}

Comments

Submit
0 Comments